//string 比较操作
#include <iostream>
#include <string>

using namespace std;

int main()
{
    string s1="abb";

    string t11="abb";
    int r11=s1.compare(t11);//用compare（）函数进行比较，相等返回的函数值是0
    cout<<s1<<"compare-->"<<t11<<"-->"<<r11<<endl;

    string t12="aaa";
    int r12=s1.compare(t12);//括号里面的比外面的大，输出正数
    cout<<s1<<"compare-->"<<t12<<"-->"<<r12<<endl;
    string t13="acc";
    int r13=s1.compare(t13);//括号里面的比外面的小，输出负数
    cout<<s1<<"compare-->"<<t13<<"-->"<<r13<<endl;
    string t14="abba";
    int r14=s1.compare(t14);
    cout<<s1<<"compare-->"<<t14<<"-->"<<r14<<endl;
    int t=(s1==t11);
    cout<<s1<<"=="<<t11<<"->"<<(s1==t11)<<endl;//这里输出的1是指true
    if(t)cout<<"相等"<<endl;

    return 0;
}